#include <bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int n_val[10]={13,1,2,3,5,4,4,2,2,2};
int fy=2024,fm=4,fd=13;

bool isleap(int y)
{
	if((y%4==0 && y%100!=0) || (y%400==0))
		return true;
	return false;
}

int reMonDay(int y,int m)
{
	if(m==2 && isleap(y)) return 29;
	return months[m];
}

int cal(int y,int m,int d)
{
	int res=0;
	if(d<10) res+=n_val[0];
	while(d)
	{
		res+=n_val[d%10];
		d/=10;
	}
	
	if(m<10) res+=n_val[0];
	while(m)
	{
		res+=n_val[m%10];
		m/=10;
	}
	
	while(y)
	{
		res+=n_val[y%10];
		y/=10;
	}
	return res;
}

void solve()
{
	int bask=0;
	for(int y=2000,m=1,d=1;;d++)
	{
		if(d > reMonDay(y,m))
		{
			d=1;
			m++;
		}
		
		if(m==13)
		{
			m=1;
			y++;
		}

		int t=cal(y,m,d);
		if(t>50) bask++;
		
		if(y==2024 && m == 4 && d == 13) break;
	}
	cout<<bask;
}
signed main()
{
	IOS;
	solve();
	return 0;
 } 
